#include "qtutilities.h"
#include <QStyleOption>
#include <QStylePainter>

QString QtUtilities::key2str(Qt::Key k)
{
  QString ret;
  switch(k)
  {
  case Qt::Key_Left:
    ret += "Left Arrow";
    break;
  case Qt::Key_Right:
    ret += "Right Arrow";
    break;
  case Qt::Key_Up:
    ret += "Up Arrow";
    break;
  case Qt::Key_Down:
    ret += "Down Arrow";
    break;
  default:
    ret += static_cast<char>(k);
  }
  return ret;
}

void QtUtilities::applyStylesheet(QWidget *w)
{
  QStyleOption opt;
  opt.init(w);
  QStylePainter p(w);
  p.drawPrimitive(QStyle::PE_Widget, opt);
}
